<?php

class UpdateOrderPackageStatus extends DataExtension {
    function onAfterWrite() {
        if($this->owner->isChanged('Status') && $this->owner->Status){
            if($order_package = OrderPackage::get()->find('PaymentReceiptID', $this->owner->ID)){
                OrderPackage::update_status($order_package->ID, $this->owner->Status, $this->owner->Remark);
            }
        }
    }

}
